package es.xpt.ysf.commons.enums;


import es.xpt.ysf.commons.business.model.EnumNames;
import es.xpt.ysf.commons.enums.model.EnumName;

public class EnumNameFactory {
	
	@SuppressWarnings("unchecked")
	public static EnumName getEnumNameValue(String enumName) {
		try {
			return EnumNames.valueOf(enumName);
		} catch ( IllegalArgumentException e ) {
			try {
				return (EnumName) Enum.valueOf(Class.forName("es.xpt.travelio.commons.model.EnumNames").asSubclass(Enum.class), enumName);
			} catch ( IllegalArgumentException e1 ) {
				try {
					return (EnumName)Enum.valueOf(Class.forName("es.xpt.travelio.commons.model.BoaEnumNames").asSubclass(Enum.class), enumName);
				} catch (ClassNotFoundException e2) {
					return null;
				}
			} catch (ClassNotFoundException e1) {
				return null;
			}
			
		}
	}
}
